<template>
  <div>
    <el-form-item label="图标">
      <avue-input-icon v-model="localData.icon" :icon-list="fontIconList" placeholder="图标" />
    </el-form-item>
    <el-form-item label="开启折叠">
      <el-switch v-model="localData.arrow" />
    </el-form-item>
    <el-form-item label="默认展开" v-if="localData.arrow">
      <el-switch v-model="localData.collapse" />
    </el-form-item>
  </div>
</template>
<script>
import { fontIconList } from '@code/components/anvil-code-low-common/utils/avueIconList'
export default {
  name: 'ConfigGroup',
  props: {
    data: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      fontIconList,
      localData: {}
    }
  },
  watch: {
    data: {
      handler(newVal) {
        if (newVal) {
          this.localData = newVal
        }
      },
      deep: true,
      immediate: true
    },
    localData: {
      handler(newVal) {
        this.$emit('update:data', newVal)
      },
      deep: true
    }
  }
}
</script>
<style lang="scss" scoped>
:deep(.avue-icon) {
  display: block;
}
</style>
